﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace XNA_3DFramWork
{
    class CKeyBoard :GameObject, IDirectInput<KeyboardState>
    {
        private readonly Camera _camera;
        public CKeyBoard(Game game,Camera camera) : base(game)
        {
            _camera = camera;
        }

        public void Setcameralocation(KeyboardState input)
        {
            if (input.IsKeyDown(Keys.W))
            {
                _camera.Move(0, 0.0f, -.1f);
            }
            if (input.IsKeyDown(Keys.S))
            {
                _camera.Move(0, -0.1f, 0f);
            }
            if (input.IsKeyDown(Keys.D))
            {
                _camera.Move(0.1f, 0, 0);
            }
            if (input.IsKeyDown(Keys.A))
            {
                _camera.Move(-0.1f, 0, 0);
            }
            if (input.IsKeyDown(Keys.X))
            {
                _camera.Move(0, .1f, 0);
            }
            if (input.IsKeyDown(Keys.Right))
            {
                _camera.RotateY(.004f);
            }
            if (input.IsKeyDown(Keys.Left))
            {
                _camera.RotateY(-.004f);
            }
            if (input.IsKeyDown(Keys.Up))
            {
                _camera.RotateX(-.004f);
            }
        }

        public override void Draw()
        {
            
        }

        public override void Update()
        {
            
        }
    }
}
